package com.xinyan.study.controller;

import com.xinyan.study.cache.CompanyCache;
import com.xinyan.study.dto.Company;
import com.xinyan.study.repository.CompanyRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author xinyan.xie
 * @description
 * @date 2020/9/30
 */
@RestController
@Slf4j
@RequestMapping("/api/lagou/web")
public class LagouController {

    @Autowired
    private CompanyRepository companyRepository;

    @Autowired
    private CompanyCache companyCache;

    @GetMapping("/company/{id}")
    private List<Company> getAllCompanyList(@PathVariable Long id){
        List<Company> companyByCompanyId = companyCache.getCompanyByCompanyId(id);
        return companyByCompanyId;
    }
}
